package edu.zut.cs.software.cms.module.teacher.service.impl;
/*
 *  @author 15869
 */


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import edu.zut.cs.software.cms.base.service.impl.GenericManagerImpl;
import edu.zut.cs.software.cms.module.teacher.dao.TeacherDao;
import edu.zut.cs.software.cms.module.teacher.domain.Teacher;
import edu.zut.cs.software.cms.module.teacher.service.TeacherManager;
@Service(value="teacherManager")
public class TeacherManagerImpl extends GenericManagerImpl<Teacher,Long > implements TeacherManager {
	TeacherDao teacherdao;

	
	@Autowired
	public void setTeacherDao(TeacherDao teacherDao) {
		this.teacherdao = teacherDao;
		this.dao = this.teacherdao;
	}
	@Override
	public boolean deleteById(long id) {
		if (teacherdao.IfOneExist(id) > 0)
			return true;
		else
			return false;
}
	@Override
	public boolean modifyById(Long id, String grade) {
		// TODO Auto-generated method stub
		Teacher teacher =new Teacher();
		teacher=teacherdao.modifyById(id);
		teacher.setGrade(grade);
		return false;
	}
	@Override
	public boolean IfExist(String name) {
		//数据存在返回false
		//数据不存在返回true
		if((teacherdao.IfOneExist(name))>0) 
			return false;
		else
			return true;
	}
	
}